package tw.spring.demo.model;

import com.fasterxml.jackson.annotation.*;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Date;
import java.util.List;

/**
 * @author: 陈艺博
 * @date: 2021-02-03 21:13
 * @description: 文章实体类
 **/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@JsonPropertyOrder(value = {"id", "auther", "title"})
@ApiModel(value = "文章类")
public class Article {

    @ApiModelProperty(value = "Id")
    private Long id;

    @ApiModelProperty(value = "标题")
    private String title;

    @ApiModelProperty(value = "作者")
    @JsonProperty("auther")
    private String author;

    @ApiModelProperty(required = true, value = "内容")
    @JsonInclude(JsonInclude.Include.NON_NULL)
    private String content;

    @ApiModelProperty(value = "创建时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Shanghai")
    private Date creatDate;

    @JsonIgnore
    @ApiModelProperty(value = "更新时间")
    private Date updateDate;

    @ApiModelProperty(value = "读者列表")
    private List<Reader> readers;
}
